package com.meowcook.mapper;

import com.meowcook.pojo.dto.HealthInfoDTO;
import com.meowcook.pojo.po.HealthInfo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 28792
 * Date: 2025-05-15
 * Time: 19:00
 */
@Mapper(componentModel = "spring")
public interface HealthInfoPojoMapper {
    HealthInfoPojoMapper INSTANCE = Mappers.getMapper(HealthInfoPojoMapper.class);

    @Mapping(source = "healthInfoDTO.height", target = "height")
    @Mapping(source = "healthInfoDTO.weight", target = "weight")
    @Mapping(source = "healthInfoDTO.age", target = "age")
    @Mapping(source = "healthInfoDTO.diseases", target = "diseases")
    @Mapping(source = "healthInfoDTO.flavor", target = "flavor")
    HealthInfo toPO(HealthInfoDTO healthInfoDTO);

    @Mapping(source = "healthInfoDTO.height", target = "height")
    @Mapping(source = "healthInfoDTO.weight", target = "weight")
    @Mapping(source = "healthInfoDTO.age", target = "age")
    @Mapping(source = "healthInfoDTO.diseases", target = "diseases")
    @Mapping(source = "healthInfoDTO.flavor", target = "flavor")
    List<HealthInfo> toPO(List<HealthInfoDTO> healthInfoDTOs);
}
